SG Window
Enumerating Windows

©1998 by Stinga

Reference     Events     Constants     Error Codes     How To...     FAQ

SG Window library contains handy Windows collection. This collection contains Window objects. Collection of a Window objects can be retrieved as a result of a FindWindows method or from the Children property of the Window object.

Windows collection is a static snapshot. Items are determined at the moment collection is created, so if you cache this collection be aware that some windows may have been destroyed by the time they are used.

Example 1

Following example shows how to find all windows that contain string "Thunder" in their class name:

   Dim desktop As New SGWindow.Window
   Dim wnd As SGWindow.Window
   Dim coll As SGWindow.Windows

   desktop.AttachDesktop
   Set coll = desktop.FindWindows("Thunder", "")
   For Each wnd in coll
      MsgBox wnd.Class & vbCrLf & wnd.Text
   Next
Example 2

Folowing example enumerates desktop window first level children

   Dim desktop As New SGWindow.Window
   Dim wnd As SGWindow.Window

   desktop.AttachDesktop
   Set coll = desktop.Children
   For Each wnd in coll
      MsgBox wnd.Class & vbCrLf & wnd.Text
   Next